package lemon5.dbutils;

import lemon1.util.JDBCUtils;
import lemon3.dao.Customer;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class QueryRunnerTest {
    public static void main(String[] args) throws SQLException, IOException, ClassNotFoundException {
        QueryRunner queryRunner = new QueryRunner();

        ResultSetHandler<Customer> handler = new ResultSetHandler<Customer>(){
            @Override
            public Customer handle(ResultSet resultSet) throws SQLException {
                return null;
            }
        };
        Connection connection = JDBCUtils.getConnection();
        String sql = "select count(*) from customers";
        Customer query =queryRunner.query(connection, sql, handler);
        System.out.println(query);
    }
}
